-
-
Notifications
You must be signed in to change notification settings - Fork 934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI Implementation with Click #2107
Conversation
Question for the team: does it make sense to write tests against this code path? I noticed there weren't tests against the existing |
yeah, let's go ahead and take the time now to add some tests against the cli. |
I think the test errors:
is because some of the commands run accelerate as a new subprocess, so don't directly call the do_inference function in this scope. |
Assuming tests pass here (they're passing in Runpod at least), this PR is ready for re-review. I think I got the testing mostly right; I'm testing mostly shallowly where I assert that args that are expected are in fact passed to the relevant As an aside, once we deprecate the old way of running axolotl commands on the command line (e.g., |
Adding context from Slack:
I also simplified some of the CLI tests so they're no longer running simple preprocess / train / shard etc. commands end to end for the sake of runtime. We have other test coverage that actually tests this functionality, so I think there's no need to duplicate. |
I need to add a way to pass |
need to update pytest calls in https://github.com/axolotl-ai-cloud/axolotl/blob/main/.github/workflows/tests.yml#L82 and on line 126 as well (and probably the nightly tests too) |
…tch other CLI test naming
Co-authored-by: Wing Lian <[email protected]>
* Initial CLI implementation with click package * Adding fetch command for pulling examples and deepspeed configs * Automating default options for CliArgs classes * Mimicking existing no config behavior * bugfix in choose_config * Updating fetch to sync instead of re-download * bugfix * isort fix * fixing yaml isort order * pre-commit fixes * simplifying argument parsing -- pass through kwargs to do_cli * make accelerate launch default for non-preprocess commands * fixing arg handling * testing None placeholder approach * removing hacky --use-gpu argument to preprocess command * Adding brief README documentation for CLI * remove (New) * Initial CLI pytest tests * progress on CLI pytest * adding inference CLI tests; cleanup * Refactor train CLI tests to remove various mocking * Major CLI test refator; adding remaining CLI codepath test coverage * pytest fixes * remove integration markers * parallelizing examples, deepspeed config downloads; rename test to match other CLI test naming * moving cli pytest due to isolation issues; cleanup * testing fixes; various minor improvements * fix * tests fix * Update tests/cli/conftest.py Co-authored-by: Wing Lian <[email protected]> --------- Co-authored-by: Dan Saunders <[email protected]> Co-authored-by: Wing Lian <[email protected]>
* Initial CLI implementation with click package * Adding fetch command for pulling examples and deepspeed configs * Automating default options for CliArgs classes * Mimicking existing no config behavior * bugfix in choose_config * Updating fetch to sync instead of re-download * bugfix * isort fix * fixing yaml isort order * pre-commit fixes * simplifying argument parsing -- pass through kwargs to do_cli * make accelerate launch default for non-preprocess commands * fixing arg handling * testing None placeholder approach * removing hacky --use-gpu argument to preprocess command * Adding brief README documentation for CLI * remove (New) * Initial CLI pytest tests * progress on CLI pytest * adding inference CLI tests; cleanup * Refactor train CLI tests to remove various mocking * Major CLI test refator; adding remaining CLI codepath test coverage * pytest fixes * remove integration markers * parallelizing examples, deepspeed config downloads; rename test to match other CLI test naming * moving cli pytest due to isolation issues; cleanup * testing fixes; various minor improvements * fix * tests fix * Update tests/cli/conftest.py Co-authored-by: Wing Lian <[email protected]> --------- Co-authored-by: Dan Saunders <[email protected]> Co-authored-by: Wing Lian <[email protected]>
Description
This PR implements a simple CLI using
click
. Note the following entrypoint:This means, once
pip install
ed,axolotl
's CLI can be used as:It support the following commands:
axolotl preprocess
axolotl train
axolotl inference
axolotl shard
axolotl merge_sharded_fsdp_weights
axolotl merge_lora
axolotl fetch
The last command is new functionality which allows the user to download (really, sync) the contents of the
examples/
anddeepspeed_configs/
directories at the top level of theaxolotl
project. For example:An optional argument
--dest [directory]
allows the user to specify an output location; otherwise, this defaults toexamples/
anddeepspeed_configs/
in the local directory.Motivation and Context
This change was requested in this Notion ticket. This allows
axolotl
users that have installed the package viapip
to use the existing CLI commands, and source users to use them with a slightly simpler interfaceaxolotl [command] ...
.How has this been tested?
Ad hoc testing on
axolotlai/axolotl-cloud:main-latest
image on a Runpod A40 instance on this feature branch. I sparsely tested thepreprocess
,train
, andfetch
commands.TODO:
pytest
coverage for the CLI (?)Types of changes
This PR adds a new file
src/axolotl/cli/main.py
which implements the Click CLI commands, and minor changes elsewhere to accommodate them.